﻿////////////////////////////////////////////////////////////////////////////////////
//
//   ParseDTD.h
//   Description: parse dtd file into std::list<CElement>
//   Revision History: 03/25/2020 created by Zhang Hong
//
////////////////////////////////////////////////////////////////////////////////////

#ifndef _PARSEDTD_H_
#define _PARSEDTD_H_

#include <QTreeWidget>
#include <QString>
#include <list>

struct Attrib
{
	QString name;
	QString default;
};

class CElement
{
public:
	CElement() { ; }
	~CElement() { ; }

	QString name;
	std::list<Attrib> propList;
	QStringList subElmList;
	QStringList parentElmList;

	bool isSubElement(const QString &elmName);

};
CElement *TopElement(std::list<CElement> &elmList);
CElement *FindElement(std::list<CElement> &elmList, const QString &name);
const CElement *FindElement(const std::list<CElement> &elmList, const QString &name);

int ParseDTD(const QString &dtd, std::list<CElement> &elmList, QTreeWidget *treeWidget);

#endif